public class Page_96_7 {
    public static void main(String[] args) {
        int arr[][] = new int[3][3];
        int i,j,k;
        for(i = 0;i<3;i++)
        {
            for(j = 0;j<3;j++)
            {
                arr[i][j] = (int)(Math.random()*10);
                System.out.printf("%d ",arr[i][j]);
            }
            System.out.println();
        }
        int a = 0,b = 0;
        int m = 2;
        for(i = 0;i < 3;i++)
        {

            b = b+arr[i][m];
            m--;

            for(k = 0;k < 3;k++ )
            {
                if(i == k)
                {
                    a = a + arr[i][k];
                }
            }
        }
        System.out.println(a-b);

    }
}
